/**
 * 
 */
package smallChanges.statements;

import java.util.List;

import smallChanges.Tokenization.TokenSet;

/**
 * @author jspacco
 *
 */
public class IfStatement extends CompoundStatement
{
	private StatementList elseBody;
	
	public IfStatement(TokenSet tokentSet) {
		super(tokentSet);
	}
	
	String toStringHelper(int depth)
	{
		return makePadding(depth) +getHeaderStmt().getImage() +
			" with " + getBody().size()+
			" stmts, whole stmt at " +getCoords()+ "\n"+
			getBody().toStringHelper(depth) +"\n"+
			((getElseBody()!=null)?getElseBody().toStringHelper(depth):"");
	}
	
	List<Statement> flattenHelper(List<Statement> list) {
		list=super.flattenHelper(list);
		if (getElseBody()!=null) {
			list=getElseBody().flattenHelper(list);
		}
        return list;
    }

	/**
	 * @return the elseBody
	 */
	public StatementList getElseBody()
	{
		return elseBody;
	}

	/**
	 * @param elseBody the elseBody to set
	 */
	public void setElseBody(StatementList elseBody)
	{
		this.elseBody = elseBody;
	}
	
	
}
